package com.example.stu.controller;

import com.example.stu.entity.Result;
import com.example.stu.pojo.ManagerLogin;
import com.example.stu.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @Date: 2021/3/29
 * @Author: 黄先军
 * @Description:
 */
@RestController
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private StudentService studentService;

    /**
     * 更具专业id来查询对应的已到和未到人数
     * @param major
     * @return
     */
    @RequestMapping("getStuReport")
    public Result manageLogin(String major) {
        Map<String,Integer> map = new HashMap<>();
        Map<String, Integer> stuInSchool = studentService.findStuInSchool(major);
        //到校人数
        map.put("OK",stuInSchool.get("All"));
        //未到校人数
        map.put("NOTOK",stuInSchool.get("inSchool"));
        return new Result(true,null,map);
    }
}
